package fr.cephb.joperon.core.db;

import java.io.File;



import fr.cephb.joperon.core.Operon;
import fr.cephb.joperon.core.db.base.BaseXTermsDB;
import fr.cephb.joperon.core.entities.XTerms;
import fr.cephb.joperon.core.iterator.DatabaseValueIterator;
import fr.cephb.util.Pair;

public class XTermsDB extends BaseXTermsDB {

	public XTermsDB(Operon operon) {
		super(operon);
	}
	
	


	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Operon op = Operon.newInstance(new File("/operon2/bdb"));
			XTermsDB db= new XTermsDB(op);
			db.open();
			int i=0;
			XTermsDB.KeyValueIterator iter=db.listKeyValues();
			while(iter.hasNext())
				{
				Pair<Integer,XTerms> p=iter.next();
				//if(p.first().length()==0) continue;
				System.err.println("["+p.first()+"] "+p.second());
				if(++i==50) break;
				}
			iter.close();
			System.err.println("=");
			DatabaseValueIterator<XTerms> iter2=db.listValues(100663296);
			while(iter2.hasNext())
				{
				XTerms x=iter2.next();
				System.err.println(x);
				}
			iter2.close();
			
			
			
			db.close();
			op.close();
		} catch (Exception e) {
		e.printStackTrace();
		}
	}

}
